package com.lm.dubbo.inter.impl;

import com.lm.dubbo.inter.GreetingService;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.extension.Adaptive;
import org.apache.dubbo.common.extension.ExtensionLoader;

@Adaptive
public class AdaptiveGreetingService implements GreetingService {
    @Override
    public void sayHello(String name) {
        URL url = new URL("dubbo", "localhost", 8080);
        String greetingType = url.getParameter("greeting", "english");
        GreetingService service = ExtensionLoader.getExtensionLoader(GreetingService.class).getExtension(greetingType);
        service.sayHello(name);
    }
}